Conversation
If DEBUG and DEBUG_TOOLBAR are set, django-debug-toolbar will be enabled and configured. Refs: RATYK-156
On large tables DISTINCT tends to result in a heavy operation with Django. The intention is to remove duplicate rows that can result from filtering via many-to-many relations. This can usually be worked around and in this case we can manually prefetch id numbers to avoid expensive JOINS against the address table. Refs: RATYK-156
These were originally added to work around bugs in earlier Postgres versions. Presumably should not happen anymore. They seem to have a small performance cost. Refs: RATYK-156
Removes a lot of duplicate queries from endpoints by setting appropriate select_related and prefetch_related. Refs: RATYK-156
|
PAIKKATIETOHAKU-API branch is deployed to platta: https://paikkatietohaku-api-pr93.api.dev.hel.ninja 🚀🚀🚀 |
|
PAIKKATIETOHAKU-API branch is deployed to platta: https://paikkatietohaku-api-pr93.api.dev.hel.ninja 🚀🚀🚀 |
danipran
approved these changes
Jan 27, 2026
|
PAIKKATIETOHAKU-API branch is deployed to platta: https://paikkatietohaku-api-pr93.api.dev.hel.ninja 🚀🚀🚀 |
The index includes all the fields that the address rest endpoint uses which result in very fast index-only scans. refs: RATYK-156
|
|
PAIKKATIETOHAKU-API branch is deployed to platta: https://paikkatietohaku-api-pr93.api.dev.hel.ninja 🚀🚀🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Locally I get 1000 addresses in 430 ms with
municipalitycode=091.mainbranch yields 4180 ms. https://paikkatietohaku.api.test.hel.ninja yields 45000 ms.Review/dev DB:s seem to be empty so can't test this 😒
edit: a bit of hacking around and got 6740 ms for review, 51690 ms for dev